#include "Entity.h"
#include "ForceGeneratorGravity.h"
#include "Vector3.hpp"

ForceGeneratorGravity::ForceGeneratorGravity(Vector3 *gravity) : ForceGenerator(), currentGravity(gravity)
{	}

ForceGeneratorGravity::~ForceGeneratorGravity()
{	}

//Calculate gravity if particle is registered
void ForceGeneratorGravity::Update(int id, float time)
{
	if (entityRegister->find(id) != entityRegister->end())
	{
		(*entityRegister)[id]->AddForce(*(*currentGravity * (*entityRegister)[id]->Mass()));
	}
}